
<?php

  if($this->session->userdata('is_logged_in')){
  $user = $this->session->userdata('username');
  echo '<p>Logged in as: <strong>',$user , '</strong> ',anchor('login/logout', 'Logout') ,'</p>';
  }

  echo "<h1>Top 10 Stories</h1>";

  $connect = mysql_connect("2007.ispace.ci.fsu.edu","lcd08c","7hymqfw0") or die('Unable to Connect: '. mysql_error());
	if (!$connect)
		{die ('could not connect:'. mysql_error());}

	mysql_select_db('lcd08c_Final', $connect);

	echo "<ol>";

	$result = mysql_query("SELECT * FROM Story");

        $counter = 0;

	while($counter != "10" && $row = mysql_fetch_array($result))
		{
		echo "<li>";
		echo $row['StoryTitle']." ".$row['StoryVote_StoryVoteID'];
		echo "</li>";

                $counter++;
		}

	echo "</ol>";

	mysql_close ($connect);

?>

